package com.ibm.csr.setup;

import java.sql.*;
import java.io.*;

/*
 * This class populates the SAMPLE database, assumed to be on a HOST system.
 * Note that this class does -NOT- create the database; just populates it.
 *
 * Assumptions:
 *
 *   1) The SAMPLE database must have been created and cataloged before calling this class.
 *   2) In the same directory, there's a "lobs" directory that contains the lob records
 *      for the emp_photo and emp_resume
 *
 */
public class SampleDB {
	static boolean debug = true;
	static String lobpath = SampleDB.class.getResource("/").getPath()
			+ File.separator + "lobs";

	public static void main1(String args[]) {
		if (args.length < 3) {
			System.out.println("USAGE: SampleDB <db> <userid> <pwd>");
			System.exit(0);
		}
		String hostname = args[0] + ".svl.ibm.com";
		String port = "446";
		String dbname = "STLEC1";
		String username = args[1];
		String password = args[2];
		createSampleDB(hostname, port, dbname, username, password);

	}

	public static void main(String args[]) {
		System.out.println(lobpath);
		String hostname = "csrec814.vmec.svl.ibm.com";
		String port = "446";
		String dbname = "STLEC1";
		String username = "admf001";
		String password = "c0deshop";
		createSampleDB(hostname, port, dbname, username, password);

	}

	static public void createSampleDB(String hostname, String port,
			String dbname, String username, String password) {
		Connection con = null;

		String url = "jdbc:db2://" + hostname + ":" + port + "/" + dbname + "";
		String userid = username;
		String pwd = password;

		try

		{
			Class.forName("com.ibm.db2.jcc.DB2Driver");
		} catch (java.lang.ClassNotFoundException e) {
			System.err.print("ClassNotFoundException: ");
			System.err.println(e.getMessage());
		}

		try {

			System.out.println("About to connect to " + url);
			con = DriverManager.getConnection(url, userid, pwd);

			System.out.println("Connect successful");

			Statement stmt = con.createStatement();
			PreparedStatement ps = null;

			dropTables(stmt);

			createTables(stmt);

			System.out.println("Populating tables...");

			String str;

			// admf001.DEPARTMENT
			str = "INSERT INTO admf001.DEPARTMENT VALUES('A00','SPIFFY COMPUTER SERVICE DIV.','000010','A00',NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "INSERT INTO admf001.DEPARTMENT VALUES('B01','PLANNING','000020','A00',NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "INSERT INTO admf001.DEPARTMENT VALUES('C01','INFORMATION CENTER','000030','A00',NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "INSERT INTO admf001.DEPARTMENT VALUES('D01','DEVELOPMENT CENTER', NULL,'A00',NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "INSERT INTO admf001.DEPARTMENT VALUES('D11','MANUFACTURING SYSTEMS','000060','D01',NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "INSERT INTO admf001.DEPARTMENT VALUES('D21','ADMINISTRATION SYSTEMS','000070','D01',NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "INSERT INTO admf001.DEPARTMENT VALUES('E01','SUPPORT SERVICES','000050','A00',NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "INSERT INTO admf001.DEPARTMENT VALUES('E11','OPERATIONS','000090','E01',NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "INSERT INTO admf001.DEPARTMENT VALUES('E21','SOFTWARE SUPPORT','000100','E01',NULL)";
			stmtExecuteUpdate(stmt, str, true);

			// admf001.ORG
			str = "insert into admf001.org values (10,'Head Office',160,'Corporate','New York')";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.org values (15,'New England',50,'Eastern','Boston')";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.org values (20,'Mid Atlantic',10,'Eastern','Washington')";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.org values (38,'South Atlantic',30,'Eastern','Atlanta')";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.org values (42,'Great Lakes',100,'Midwest','Chicago')";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.org values (51,'Plains',140,'Midwest','Dallas')";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.org values (66,'Pacific',270,'Western','San Francisco')";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.org values (84,'Mountain',290,'Western','Denver')";
			stmtExecuteUpdate(stmt, str, true);

			// admf001.STAFF
			str = "insert into admf001.staff values ( 10,'Sanders',20,'Mgr  ',7,+18357.50,NULL)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 20,'Pernal',20,'Sales',8,+18171.25,+00612.45)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 30,'Marenghi',38,'Mgr  ',5,+17506.75,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 40,'O''Brien',38,'Sales',6,+18006.00,+00846.55)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 50,'Hanes',15,'Mgr  ',10,+20659.80,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 60,'Quigley',38,'Sales',NULL,+16808.30,+00650.25)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 70,'Rothman',15,'Sales',7,+16502.83,+01152.00)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 80,'James',20,'Clerk',NULL,+13504.60,+00128.20)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 90,'Koonitz',42,'Sales',6,+18001.75,+01386.70)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 100,'Plotz',42,'Mgr  ',7,+18352.80,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 110,'Ngan',15,'Clerk',5,+12508.20,+00206.60)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 120,'Naughton',38,'Clerk',NULL,+12954.75,+00180.00)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 130,'Yamaguchi',42,'Clerk',6,+10505.90,+00075.60)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 140,'Fraye',51,'Mgr  ',6,+21150.00,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 150,'Williams',51,'Sales',6,+19456.50,+00637.65)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 160,'Molinare',10,'Mgr  ',7,+22959.20,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 170,'Kermisch',15,'Clerk',4,+12258.50,+00110.10)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 180,'Abrahams',38,'Clerk',3,+12009.75,+00236.50)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 190,'Sneider',20,'Clerk',8,+14252.75,+00126.50)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 200,'Scoutten',42,'Clerk',NULL,+11508.60,+00084.20)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 210,'Lu',10,'Mgr  ',10,+20010.00,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 220,'Smith',51,'Sales',7,+17654.50,+00992.80)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 230,'Lundquist',51,'Clerk',3,+13369.80,+00189.65)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 240,'Daniels',10,'Mgr  ',5,+19260.25,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 250,'Wheeler',51,'Clerk',6,+14460.00,+00513.30)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 260,'Jones',10,'Mgr  ',12,+21234.00,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 270,'Lea',66,'Mgr  ',9,+18555.50,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 280,'Wilson',66,'Sales',9,+18674.50,+00811.50)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 290,'Quill',84,'Mgr  ',10,+19818.00,null)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 300,'Davis',84,'Sales',5,+15454.50,+00806.10)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 310,'Graham',66,'Sales',13,+21000.00,+00200.30)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 320,'Gonzales',66,'Sales',4,+16858.20,+00844.00)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 330,'Burke',66,'Clerk',1,+10988.00,+00055.50)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 340,'Edwards',84,'Sales',7,+17844.00,+01285.00)";
			stmtExecuteUpdate(stmt, str, true);
			str = "insert into admf001.staff values ( 350,'Gafney',84,'Clerk',5,+13030.50,+00188.00)";
			stmtExecuteUpdate(stmt, str, true);

			// admf001.EMPLOYEE
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000010','CHRISTINE','I','HAAS','A00','3978','1965-01-01','PRES    ',18,'F','1933-08-24',+0052750.00,+0001000.00,+0004220.00        )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000020','MICHAEL','L','THOMPSON','B01','3476','1973-10-10','MANAGER ',18,'M','1948-02-02',+0041250.00,+0000800.00,+0003300.00      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000030','SALLY','A','KWAN','C01','4738','1975-04-05','MANAGER ',20,'F','1941-05-11',+0038250.00,+0000800.00,+0003060.00            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000050','JOHN','B','GEYER','E01','6789','1949-08-17','MANAGER ',16,'M','1925-09-15',+0040175.00,+0000800.00,+0003214.00            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000060','IRVING','F','STERN','D11','6423','1973-09-14','MANAGER ',16,'M','1945-07-07',+0032250.00,+0000500.00,+0002580.00          )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000070','EVA','D','PULASKI','D21','7831','1980-09-30','MANAGER ',16,'F','1953-05-26',+0036170.00,+0000700.00,+0002893.00           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000090','EILEEN','W','HENDERSON','E11','5498','1970-08-15','MANAGER ',16,'F','1941-05-15',+0029750.00,+0000600.00,+0002380.00      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000100','THEODORE','Q','SPENSER','E21','0972','1980-06-19','MANAGER ',14,'M','1956-12-18',+0026150.00,+0000500.00,+0002092.00      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000110','VINCENZO','G','LUCCHESSI','A00','3490','1958-05-16','SALESREP',19,'M','1929-11-05',+0046500.00,+0000900.00,+0003720.00    )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000120','SEAN',' ','O''CONNELL','A00','2167','1963-12-05','CLERK   ',14,'M','1942-10-18',+0029250.00,+0000600.00,+0002340.00        )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000130','DOLORES','M','QUINTANA','C01','4578','1971-07-28','ANALYST ',16,'F','1925-09-15',+0023800.00,+0000500.00,+0001904.00      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000140','HEATHER','A','NICHOLLS','C01','1793','1976-12-15','ANALYST ',18,'F','1946-01-19',+0028420.00,+0000600.00,+0002274.00      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000150','BRUCE',' ','ADAMSON','D11','4510','1972-02-12','DESIGNER',16,'M','1947-05-17',+0025280.00,+0000500.00,+0002022.00         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000160','ELIZABETH','R','PIANKA','D11','3782','1977-10-11','DESIGNER',17,'F','1955-04-12',+0022250.00,+0000400.00,+0001780.00      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000170','MASATOSHI','J','YOSHIMURA','D11','2890','1978-09-15','DESIGNER',16,'M','1951-01-05',+0024680.00,+0000500.00,+0001974.00   )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000180','MARILYN','S','SCOUTTEN','D11','1682','1973-07-07','DESIGNER',17,'F','1949-02-21',+0021340.00,+0000500.00,+0001707.00      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000190','JAMES','H','WALKER','D11','2986','1974-07-26','DESIGNER',16,'M','1952-06-25',+0020450.00,+0000400.00,+0001636.00          )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000200','DAVID',' ','BROWN','D11','4501','1966-03-03','DESIGNER',16,'M','1941-05-29',+0027740.00,+0000600.00,+0002217.00           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000210','WILLIAM','T','JONES','D11','0942','1979-04-11','DESIGNER',17,'M','1953-02-23',+0018270.00,+0000400.00,+0001462.00         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000220','JENNIFER','K','LUTZ','D11','0672','1968-08-29','DESIGNER',18,'F','1948-03-19',+0029840.00,+0000600.00,+0002387.00         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000230','JAMES','J','JEFFERSON','D21','2094','1966-11-21','CLERK   ',14,'M','1935-05-30',+0022180.00,+0000400.00,+0001774.00       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000240','SALVATORE','M','MARINO','D21','3780','1979-12-05','CLERK   ',17,'M','1954-03-31',+0028760.00,+0000600.00,+0002301.00      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000250','DANIEL','S','SMITH','D21','0961','1969-10-30','CLERK   ',15,'M','1939-11-12',+0019180.00,+0000400.00,+0001534.00          )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000260','SYBIL','P','JOHNSON','D21','8953','1975-09-11','CLERK   ',16,'F','1936-10-05',+0017250.00,+0000300.00,+0001380.00         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000270','MARIA','L','PEREZ','D21','9001','1980-09-30','CLERK   ',15,'F','1953-05-26',+0027380.00,+0000500.00,+0002190.00           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000280','ETHEL','R','SCHNEIDER','E11','8997','1967-03-24','OPERATOR',17,'F','1936-03-28',+0026250.00,+0000500.00,+0002100.00       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000290','JOHN','R','PARKER','E11','4502','1980-05-30','OPERATOR',12,'M','1946-07-09',+0015340.00,+0000300.00,+0001227.00           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000300','PHILIP','X','SMITH','E11','2095','1972-06-19','OPERATOR',14,'M','1936-10-27',+0017750.00,+0000400.00,+0001420.00          )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000310','MAUDE','F','SETRIGHT','E11','3332','1964-09-12','OPERATOR',12,'F','1931-04-21',+0015900.00,+0000300.00,+0001272.00        )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000320','RAMLAL','V','MEHTA','E21','9990','1965-07-07','FIELDREP',16,'M','1932-08-11',+0019950.00,+0000400.00,+0001596.00          )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000330','WING',' ','LEE','E21','2103','1976-02-23','FIELDREP',14,'M','1941-07-18',+0025370.00,+0000500.00,+0002030.00              )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.EMPLOYEE values( '000340','JASON','R','GOUNOT','E21','5698','1947-05-05','FIELDREP',16,'M','1926-05-17',+0023840.00,+0000500.00,+0001907.00          )",
					true);

			// admf001.EMP_ACT
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000010','MA2100',10,+000.50,'1982-01-01','1982-11-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000010','MA2110',10,+001.00,'1982-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000010','AD3100',10,+000.50,'1982-01-01','1982-07-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000020','PL2100',30,+001.00,'1982-01-01','1982-09-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000030','IF1000',10,+000.50,'1982-06-01','1983-01-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000030','IF2000',10,+000.50,'1982-01-01','1983-01-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000050','OP1000',10,+000.25,'1982-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000050','OP2010',10,+000.75,'1982-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000070','AD3110',10,+001.00,'1982-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000090','OP1010',10,+001.00,'1982-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000100','OP2010',10,+001.00,'1982-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000110','MA2100',20,+001.00,'1982-01-01','1982-03-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000130','IF1000',90,+001.00,'1982-01-01','1982-10-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000130','IF1000',100,+000.50,'1982-10-01','1983-01-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000140','IF1000',90,+000.50,'1982-10-01','1983-01-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000140','IF2000',100,+001.00,'1982-01-01','1982-03-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000140','IF2000',100,+000.50,'1982-03-01','1982-07-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000140','IF2000',110,+000.50,'1982-03-01','1982-07-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000140','IF2000',110,+000.50,'1982-10-01','1983-01-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000150','MA2112',60,+001.00,'1982-01-01','1982-07-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000150','MA2112',180,+001.00,'1982-07-15','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000160','MA2113',60,+001.00,'1982-07-15','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000170','MA2112',60,+001.00,'1982-01-01','1983-06-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000170','MA2112',70,+001.00,'1982-06-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000170','MA2113',80,+001.00,'1982-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000180','MA2113',70,+001.00,'1982-04-01','1982-06-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000190','MA2112',70,+001.00,'1982-02-01','1982-10-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000190','MA2112',80,+001.00,'1982-10-01','1983-10-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000200','MA2111',50,+001.00,'1982-01-01','1982-06-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000200','MA2111',60,+001.00,'1982-06-15','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000210','MA2113',80,+000.50,'1982-10-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000210','MA2113',180,+000.50,'1982-10-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000220','MA2111',40,+001.00,'1982-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000230','AD3111',60,+001.00,'1982-01-01','1982-03-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000230','AD3111',60,+000.50,'1982-03-15','1982-04-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000230','AD3111',70,+000.50,'1982-03-15','1982-10-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000230','AD3111',80,+000.50,'1982-04-15','1982-10-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000230','AD3111',180,+001.00,'1982-10-15','1983-01-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000240','AD3111',70,+001.00,'1982-02-15','1982-09-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000240','AD3111',80,+001.00,'1982-09-15','1983-01-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',60,+001.00,'1982-01-01','1982-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',60,+000.50,'1982-02-01','1982-03-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',60,+000.50,'1982-12-01','1983-01-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',60,+001.00,'1983-01-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',70,+000.50,'1982-02-01','1982-03-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',70,+001.00,'1982-03-15','1982-08-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',70,+000.25,'1982-08-15','1982-10-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',80,+000.25,'1982-08-15','1982-10-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',80,+000.50,'1982-10-15','1982-12-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000250','AD3112',180,+000.50,'1982-08-15','1983-01-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000260','AD3113',70,+000.50,'1982-06-15','1982-07-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000260','AD3113',70,+001.00,'1982-07-01','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000260','AD3113',80,+001.00,'1982-01-01','1982-03-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000260','AD3113',80,+000.50,'1982-03-01','1982-04-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000260','AD3113',180,+000.50,'1982-03-01','1982-04-15'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000260','AD3113',180,+001.00,'1982-04-15','1982-06-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000260','AD3113',180,+000.50,'1982-06-01','1982-07-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000270','AD3113',60,+000.50,'1982-03-01','1982-04-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000270','AD3113',60,+001.00,'1982-04-01','1982-09-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000270','AD3113',60,+000.25,'1982-09-01','1982-10-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000270','AD3113',70,+000.75,'1982-09-01','1982-10-15'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000270','AD3113',70,+001.00,'1982-10-15','1983-02-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000270','AD3113',80,+001.00,'1982-01-01','1982-03-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000270','AD3113',80,+000.50,'1982-03-01','1982-04-01'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000280','OP1010',130,+001.00,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000290','OP1010',130,+001.00,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000300','OP1010',130,+001.00,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000310','OP1010',130,+001.00,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000320','OP2011',140,+000.75,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000320','OP2011',150,+000.25,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000330','OP2012',140,+000.25,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000330','OP2012',160,+000.75,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000340','OP2013',140,+000.50,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000340','OP2013',170,+000.50,'1982-01-01','1983-02-01'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.emp_act values('000020','PL2100',30,+001.00,'1982-01-01','1982-09-15'       )",
					true);

			// admf001.PROJECT
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'AD3100','ADMIN SERVICES','D01','000010',+006.50,'1982-01-01','1983-02-01','      '           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'AD3110','GENERAL ADMIN SYSTEMS','D21','000070',+006.00,'1982-01-01','1983-02-01','AD3100'    )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'AD3111','PAYROLL PROGRAMMING','D21','000230',+002.00,'1982-01-01','1983-02-01','AD3110'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'AD3112','PERSONNEL PROGRAMMING','D21','000250',+001.00,'1982-01-01','1983-02-01','AD3110'    )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'AD3113','ACCOUNT PROGRAMMING','D21','000270',+002.00,'1982-01-01','1983-02-01','AD3110'      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'IF1000','QUERY SERVICES','C01','000030',+002.00,'1982-01-01','1983-02-01', null )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'IF2000','USER EDUCATION','C01','000030',+001.00,'1982-01-01','1983-02-01', null)",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'MA2100','WELD LINE AUTOMATION','D01','000010',+012.00,'1982-01-01','1983-02-01', null)",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'MA2110','W L PROGRAMMING','D11','000060',+009.00,'1982-01-01','1983-02-01','MA2100'  )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'MA2111','W L PROGRAM DESIGN','D11','000220',+002.00,'1982-01-01','1982-12-01','MA2110'   )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'MA2112','W L ROBOT DESIGN','D11','000150',+003.00,'1982-01-01','1982-12-01','MA2110'     )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'MA2113','W L PROD CONT PROGS','D11','000160',+003.00,'1982-02-15','1982-12-01','MA2110'  )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'OP1000','OPERATION SUPPORT','E01','000050',+006.00,'1982-01-01','1983-02-01',            null )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'OP1010','OPERATION','E11','000090',+005.00,'1982-01-01','1983-02-01','OP1000'            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'OP2000','GEN SYSTEMS SERVICES','E01','000050',+005.00,'1982-01-01','1983-02-01',null)",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'OP2010','SYSTEMS SUPPORT','E21','000100',+004.00,'1982-01-01','1983-02-01','OP2000' )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'OP2011','SCP SYSTEMS SUPPORT','E21','000320',+001.00,'1982-01-01','1983-02-01','OP2010')",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'OP2012','APPLICATIONS SUPPORT','E21','000330',+001.00,'1982-01-01','1983-02-01','OP2010')",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'OP2013','DB/DC SUPPORT','E21','000340',+001.00,'1982-01-01','1983-02-01','OP2010'       )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.project values ( 'PL2100','WELD LINE PLANNING','B01','000020',+001.00,'1982-01-01','1982-09-15','MA2100'  )",
					true);

			// admf001.SALES
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1995-12-31','LUCCHESSI','Ontario-South',1      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1995-12-31','LEE','Ontario-South',3            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1995-12-31','LEE','Quebec',1                   )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1995-12-31','LEE','Manitoba',2                 )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1995-12-31','GOUNOT','Quebec',1                )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','LUCCHESSI','Ontario-South',3      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','LUCCHESSI','Quebec',1             )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','LEE','Ontario-South',2            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','LEE','Ontario-North',2            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','LEE','Quebec',3                   )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','LEE','Manitoba',5                 )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','GOUNOT','Ontario-South',3         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','GOUNOT','Quebec',1                )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-29','GOUNOT','Manitoba',7              )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','LUCCHESSI','Ontario-South',1      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','LUCCHESSI','Quebec',2             )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','LUCCHESSI','Manitoba',1           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','LEE','Ontario-South',7            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','LEE','Ontario-North',3            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','LEE','Quebec',7                   )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','LEE','Manitoba',4                 )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','GOUNOT','Ontario-South',2         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','GOUNOT','Quebec',18               )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-30','GOUNOT','Manitoba',1              )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-31','LUCCHESSI','Manitoba',1           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-31','LEE','Ontario-South',14           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-31','LEE','Ontario-North',3            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-31','LEE','Quebec',7                   )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-31','LEE','Manitoba',3                 )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-31','GOUNOT','Ontario-South',2         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-03-31','GOUNOT','Quebec',1                )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','LUCCHESSI','Ontario-South',3      )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','LUCCHESSI','Manitoba',1           )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','LEE','Ontario-South',8            )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','LEE','Ontario-North',NULL         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','LEE','Quebec',8                   )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','LEE','Manitoba',9                 )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','GOUNOT','Ontario-South',3         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','GOUNOT','Ontario-North',1         )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','GOUNOT','Quebec',3                )",
					true);
			stmtExecuteUpdate(
					stmt,
					"insert into admf001.sales values( '1996-04-01','GOUNOT','Manitoba',7              )",
					true);

			// admf001.EMP_PHOTO
			ps = con
					.prepareStatement("INSERT INTO admf001.EMP_PHOTO(EMPNO, PHOTO_FORMAT, PICTURE) VALUES ( ?, ?, ? )");

			File[] fAry = new File[12];
			FileInputStream[] fisAry = new FileInputStream[12];
			for (int j = 1; j <= 12; j++) {
				String num = new String("00" + j);
				num = num.substring(num.length() - 3, num.length());
				fAry[j - 1] = new File(lobpath + File.separator + "photo."
						+ num);
				fisAry[j - 1] = new FileInputStream(fAry[j - 1]);

				if (debug) {
					System.out.println("Lob: " + fAry[j - 1].toString());
				}
			}

			int i = 0;
			ps.setObject(1, "000130", Types.CHAR);
			ps.setObject(2, "bitmap", Types.VARCHAR);
			ps.setObject(3, null, Types.BLOB);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000130", Types.CHAR);
			ps.setObject(2, "gif", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000130", Types.CHAR);
			ps.setObject(2, "xwd", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000140", Types.CHAR);
			ps.setObject(2, "bitmap", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000140", Types.CHAR);
			ps.setObject(2, "gif", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000140", Types.CHAR);
			ps.setObject(2, "xwd", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000150", Types.CHAR);
			ps.setObject(2, "bitmap", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000150", Types.CHAR);
			ps.setObject(2, "gif", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000150", Types.CHAR);
			ps.setObject(2, "xwd", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000190", Types.CHAR);
			ps.setObject(2, "bitmap", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000190", Types.CHAR);
			ps.setObject(2, "gif", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000190", Types.CHAR);
			ps.setObject(2, "xwd", Types.VARCHAR);
			ps.setBinaryStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			// admf001.EMP_PHOTO
			ps = con
					.prepareStatement("INSERT INTO admf001.EMP_RESUME(EMPNO, RESUME_FORMAT, RESUME) VALUES ( ?, ?, ? )");
			fAry = new File[8];
			fisAry = new FileInputStream[8];
			for (int j = 1; j <= 8; j++) {
				String num = new String("00" + j);
				num = num.substring(num.length() - 3, num.length());
				fAry[j - 1] = new File(lobpath + File.separator + "resume."
						+ num);
				fisAry[j - 1] = new FileInputStream(fAry[j - 1]);

				if (debug) {
					System.out.println(fAry[j - 1].toString());
				}
			}

			i = 0;
			ps.setObject(1, "000130", Types.CHAR);
			ps.setObject(2, "ascii", Types.VARCHAR);
			ps.setObject(3, "", Types.CLOB);
			ps.setAsciiStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000130", Types.CHAR);
			ps.setObject(2, "script", Types.VARCHAR);
			ps.setAsciiStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000140", Types.CHAR);
			ps.setObject(2, "ascii", Types.VARCHAR);
			ps.setAsciiStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000140", Types.CHAR);
			ps.setObject(2, "script", Types.VARCHAR);
			ps.setAsciiStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000150", Types.CHAR);
			ps.setObject(2, "ascii", Types.VARCHAR);
			ps.setAsciiStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000150", Types.CHAR);
			ps.setObject(2, "script", Types.VARCHAR);
			ps.setAsciiStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000190", Types.CHAR);
			ps.setObject(2, "ascii", Types.VARCHAR);
			ps.setAsciiStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			i++;
			ps.setObject(1, "000190", Types.CHAR);
			ps.setObject(2, "script", Types.VARCHAR);
			ps.setAsciiStream(3, fisAry[i], (int) fAry[i].length());
			psExecuteUpdate(ps, true);

			con.close();

		} catch (Throwable ex) {
			System.out.println(ex.getMessage());
			ex.printStackTrace(System.out);
		}

		System.out.println("\nFinished");
	}

	static public void createTables(Statement stmt) throws SQLException {

		System.out.println("--> CreateTables");

		String str;
		// hao
		str = "SET CURRENT RULES = 'STD'";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.ORG ( " + "DEPTNUMB SMALLINT NOT NULL, "
				+ "DEPTNAME VARCHAR(14) , " + "MANAGER SMALLINT , "
				+ "DIVISION VARCHAR(10) , " + "LOCATION VARCHAR(13))";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.STAFF ( " + "ID SMALLINT NOT NULL , "
				+ "NAME VARCHAR(9) ,      " + "DEPT SMALLINT ,        "
				+ "JOB CHAR(5) ,          " + "YEARS SMALLINT ,       "
				+ "SALARY DECIMAL(7,2) ,  " + "COMM DECIMAL(7,2) )";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.DEPARTMENT (      "
				+ "DEPTNO CHAR(3) NOT NULL ,        "
				+ "DEPTNAME VARCHAR(29) NOT NULL ,  "
				+ "MGRNO CHAR(6) ,                  "
				+ "ADMRDEPT CHAR(3) NOT NULL ,      " + "LOCATION CHAR(16) )";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.EMPLOYEE(        "
				+ "EMPNO CHAR(6) NOT NULL ,        "
				+ "FIRSTNME VARCHAR(12) NOT NULL , "
				+ "MIDINIT CHAR(1) NOT NULL ,      "
				+ "LASTNAME VARCHAR(15) NOT NULL , "
				+ "WORKDEPT CHAR(3) ,              "
				+ "PHONENO CHAR(4) ,               "
				+ "HIREDATE DATE ,                 "
				+ "JOB CHAR(8) ,                   "
				+ "EDLEVEL SMALLINT NOT NULL ,     "
				+ "SEX CHAR(1) ,                   "
				+ "BIRTHDATE DATE ,                "
				+ "SALARY DECIMAL(9,2) ,           "
				+ "BONUS DECIMAL(9,2) ,            " + "COMM DECIMAL(9,2) )";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.EMP_ACT  (   "
				+ "EMPNO CHAR(6) NOT NULL ,   " + "PROJNO CHAR(6) NOT NULL ,  "
				+ "ACTNO SMALLINT NOT NULL ,  " + "EMPTIME DECIMAL(5,2) ,     "
				+ "EMSTDATE DATE ,            " + "EMENDATE DATE )";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.PROJECT  (  "
				+ "PROJNO CHAR(6) NOT NULL ,   "
				+ "PROJNAME VARCHAR(24) NOT NULL ,  "
				+ "DEPTNO CHAR(3) NOT NULL ,        "
				+ "RESPEMP CHAR(6) NOT NULL ,       "
				+ "PRSTAFF DECIMAL(5,2) ,           "
				+ "PRSTDATE DATE ,                  "
				+ "PRENDATE DATE ,                  " + "MAJPROJ CHAR(6) )";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.EMP_PHOTO  (  "
				+ "EMPNO CHAR(6) NOT NULL ,    "
				+ "PHOTO_FORMAT VARCHAR(10) NOT NULL ,  "
				+ "PICTURE BLOB(102400),  "
				+ "rid ROWID GENERATED ALWAYS NOT NULL)";

		stmtExecuteUpdate(stmt, str, true);
		/*
		 * hao stmtExecuteUpdate( stmt, "DROP TABLESPACE JDBC2TP1", true );
		 * stmtExecuteUpdate( stmt, "DROP INDEX PHOTOIDX", true );
		 * stmtExecuteUpdate( stmt, "CREATE LOB TABLESPACE JDBC2TP1", true );
		 * stmtExecuteUpdate( stmt,
		 * "CREATE AUX TABLE AUXTP1 IN JDBC2TP1 STORES admf001.EMP_PHOTO COLUMN PICTURE"
		 * , true ); stmtExecuteUpdate( stmt, "CREATE INDEX PHOTOIDX ON AUXTP1",
		 * true );
		 */

		str = "CREATE TABLE admf001.EMP_RESUME  ( "
				+ "EMPNO CHAR(6) NOT NULL ,   "
				+ "RESUME_FORMAT VARCHAR(10) NOT NULL , "
				+ "RESUME CLOB(5120), "
				+ "rid ROWID GENERATED ALWAYS NOT NULL)";

		stmtExecuteUpdate(stmt, str, true);
		/*
		 * hao stmtExecuteUpdate( stmt, "DROP TABLESPACE JDBC2TP2", true );
		 * stmtExecuteUpdate( stmt, "DROP INDEX RESUMEIDX", true );
		 * stmtExecuteUpdate( stmt, "CREATE LOB TABLESPACE JDBC2TP2", true );
		 * stmtExecuteUpdate( stmt,
		 * "CREATE AUX TABLE AUXTP2 IN JDBC2TP2 STORES admf001.EMP_RESUME COLUMN RESUME"
		 * , true ); stmtExecuteUpdate( stmt,
		 * "CREATE INDEX RESUMEIDX ON AUXTP2", true );
		 */
		str = "CREATE TABLE admf001.SALES ( " + "SALES_DATE DATE ,  "
				+ "SALES_PERSON VARCHAR(15) , " + "REGION VARCHAR(15) , "
				+ "SALES INTEGER )";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.CL_SCHED  ( " + "CLASS_CODE CHAR(7) ,  "
				+ "DAY SMALLINT ,        " + "STARTING TIME ,       "
				+ "ENDING TIME )";

		stmtExecuteUpdate(stmt, str, true);

		str = "CREATE TABLE admf001.IN_TRAY  (  " + "RECEIVED TIMESTAMP ,   "
				+ "SOURCE CHAR(8) ,       " + "SUBJECT CHAR(64) ,     "
				+ "NOTE_TEXT VARCHAR(3000) )";

		stmtExecuteUpdate(stmt, str, true);

		System.out.println("<-- CreateTables");

	}

	static public void dropTables(Statement stmt) throws SQLException {

		System.out.println("--> Drop Table");
		String str;
		stmtExecuteUpdate(stmt, "drop table admf001.org", true);

		str = " drop table admf001.staff";
		stmt.addBatch(str);
		str = "drop table admf001.department";
		stmt.addBatch(str);
		str = "drop table admf001.employee";
		stmt.addBatch(str);
		str = "drop table admf001.emp_act";
		stmt.addBatch(str);
		str = "drop table admf001.project";
		stmt.addBatch(str);
		str = "drop table admf001.emp_photo";
		stmt.addBatch(str);
		str = "drop table admf001.emp_resume";
		stmt.addBatch(str);
		str = "drop table admf001.sales";
		stmt.addBatch(str);
		str = "drop table admf001.cl_sched";
		stmt.addBatch(str);
		str = "drop table admf001.in_tray";
		stmt.addBatch(str);
		str = "drop table admf001.btest7";
		stmt.addBatch(str);
		str = "drop table admf001.btest1";
		stmt.addBatch(str);
		// Hao
		// str = "DROP TABLESPACE jdbc2TP1";
		// stmt.addBatch( str );
		// str = "DROP TABLESPACE jdbc2TP2";
		// stmt.addBatch( str );

		try {
			stmt.executeBatch();
		} catch (BatchUpdateException e) {
			// System.out.println("-->"+e.getMessage());
		}

		System.out.println("<-- Drop Table");
	}

	static public int stmtExecuteUpdate(Statement stmt, String sql,
			boolean ignoreException) throws SQLException {
		int updateCount = 0;
		if (ignoreException) {
			try {
				updateCount = stmt.executeUpdate(sql);
			} catch (SQLException ex) {
				if (debug) {
					System.out.println("-> " + sql + " ====> "
							+ ex.getMessage());
				}
			}
		} else {
			updateCount = stmt.executeUpdate(sql);
		}
		return updateCount;
	}

	static public int psExecuteUpdate(PreparedStatement ps,
			boolean ignoreException) throws SQLException {
		int updateCount = 0;
		if (ignoreException) {
			try {
				updateCount = ps.executeUpdate();
			} catch (SQLException e) {
				if (debug) {
					System.out.println("psExecuteUpdate failed: "
							+ e.getMessage());
				}
			}
		} else {
			updateCount = ps.executeUpdate();
		}
		return updateCount;
	}

}
